package org.jianghu.activity.user.regist.presenter;

import com.avos.avoscloud.AVException;
import com.avos.avoscloud.AVUser;
import com.avos.avoscloud.SignUpCallback;

import org.jianghu.activity.user.regist.view.RegistView;

/**
 * Created by Administrator on 2016/12/21.
 */

public class RegistPresenterCompl implements RegistPresenter{

    private RegistView registView;

    public RegistPresenterCompl(RegistView registView){
        this.registView = registView;
    }

    @Override
    public void dnRegist(String telephone, String passWord) {
        AVUser avUser = new AVUser();
        avUser.setUsername(telephone);
        avUser.setMobilePhoneNumber(telephone);
        avUser.setPassword(passWord);
        avUser.signUpInBackground(new SignUpCallback() {
            @Override
            public void done(AVException e) {
                if(e == null){
                    registView.resltRegist(true);
                    //注册成功
                }else {
                    registView.resltRegist(false);
                    //注册失败
                }
            }
        });
    }
}
